package com.txunda.zhuohired.adapter.manage.my;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.bean.manage.my.ManageResumeDataBean;
import com.txunda.zhuohired.util.GlideCircleTransform;

import java.util.List;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/14 13:45
 * 功能描述：面试日程adapter
 * 联系方式：jiahuanchen@126.com
 */

public class ManageResumeDateAdapter extends BaseAdapter {
    private Context context;
    private ViewHolder holder;
    private List<ManageResumeDataBean.DataBean> list;

    public ManageResumeDateAdapter(Context context,List<ManageResumeDataBean.DataBean> manageResumeDataBeanList) {
        this.context = context;
        this.list = manageResumeDataBeanList;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_manage_resume_date, null);
            holder = new ViewHolder();
            view.setTag(holder);
            ViewUtils.inject(holder, view);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.tv_date_name.setText(list.get(i).getName());
        holder.tv_date_work.setText(list.get(i).getTrade());
//        holder.tv_date_time.setText(list.get(i).get);
        Glide.with(context).load(list.get(i).getHead_pic())
                .dontAnimate()
                .error(R.mipmap.default_image)
                .placeholder(R.mipmap.default_image)
                .transform(new GlideCircleTransform(context))
                .into(holder.iv_manage_head);
        return view;
    }

    class ViewHolder {
        @ViewInject(R.id.iv_date_head)
        private ImageView iv_manage_head;
        @ViewInject(R.id.tv_date_name)
        private TextView tv_date_name;
        @ViewInject(R.id.tv_date_work)
        private TextView tv_date_work;
        @ViewInject(R.id.tv_date_time)
        private TextView tv_date_time;

    }
}
